/**
 * Created by Administrator on 2017/9/17.
 */
import { connect } from 'react-redux';
import ToDoApp from '../components/ToDoApp';
import {
    inputChange,
    addItem,
    itemChange,
    deleteItem,
} from '../redux/modules/toDoApp';

function mapStateToProps(state){
    return {
        toDoApp: state.toDoApp
    }
}

function mapDispatchToProps(dispatch){
    return {
        inputChange: (event)=>dispatch(inputChange(event)),
        addItem: (event)=>dispatch(addItem(event)),
        itemChange: (index)=>dispatch(itemChange(index)),
        deleteItem: (index)=>dispatch(deleteItem(index))
    };
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(ToDoApp);
